#ifndef DRAGHANDLER_H
#define DRAGHANDLER_H

#include <BBody>
#include <BViewer>
#include <BBillboard>
#include <BLine>
#include <BQuad>
#include <BSphere>
#include <BPicker>
#include <BHandler>
#include <BPointRestraint>

using namespace BWE;

class DragHandler : public BHandler
{
public:
	DragHandler();
	~DragHandler();

	BPointRestraint* pointRestraint();

	void freshDragRing(BReal axisSize);

protected:
	virtual void attached(BViewer* viewer);
	virtual void detached(BViewer* viewer);

	virtual void paint(BPainter& painter);
	virtual void render(BRender& render);

	virtual void mousePressEvent(const BMouseEvent& mouseEvent);
	virtual void mouseReleaseEvent(const BMouseEvent& mouseEvent);
	virtual void mouseMoveEvent(const BMouseEvent& mouseEvent);

protected:
	BVectorArray			_dragRingPoints;
	BLine					_dragLine;
	bool					_spaceShown;
	bool					_leftPressed;
	BLine					_linePressed;
	int						_transStep;

	BBody*					_pickedBody;
	BPickHitHolder			_pickedHit;
	BPointRestraintHolder	_pointRestraint;
	BReal					_pickingDist;

};

#endif